/*
 * IUnit.h
 *
 *  Created on: 07.12.2011
 *      Author: Kirill Blinov
 *      Copyright: LGPL
 */

#ifndef IUNIT_H_
#define IUNIT_H_

#include "../BasicTypes.h"
#include "../TStack.h"
#include "../Dynamic System/Physics Engine/IPhysicsEngine.h"
#include "../Dynamic System/CAnimationController.h"
#include "CTemplateCollection.h"
#include "ObjectRenderInfo.h"
#include <queue>
#include <string>


class IUnit
{
friend class CTemplateCollection;
private:

protected:
	IUnit( GAME_OBJECT* VisualisationInfo );
	IUnit( const IUnit& Base );
	virtual ~IUnit();

	virtual void MakeClone( CTemplateCollection* Collection ) const = 0;
	virtual bool SetName( const std::string Name );
	virtual bool SetPhysicParams( const UNIT_PHYSIC_PARAMS &PhysicParams );

protected:
	std::string            name;
	GAME_OBJECT*           visualisationInfo;
	std::queue<UINT_EVENT> eventQueue;

	CAnimationController*  animationController;//TODO Write full code for THIS!
public:
	virtual const std::string GetName() const;

	/*
	 * Updates object matrixes and parameters in physics engine
	 * according AnimationPlayer's calculations. Also this function
	 * should update Unit's render matrix with data from physics engine.
	 */
	virtual void PlayAnimation( IAnimationPlayer* ) = 0;
	virtual void PushEvent( UINT_EVENT Event ){ eventQueue.push( Event ); };
	virtual UINT_EVENT PopEvent();
	virtual void SubmithState() = 0;
	virtual GAME_OBJECT* GetVisualInfo(){ return visualisationInfo; };
	virtual void Rotate( UINT Axis, float Angle ) = 0;
	virtual void Axeleration( float Axeleration ) = 0;
};

#endif /* IUNIT_H_ */
